package com.UDP;

/**
 * @ClassName IPDemo
 * @Description InetAddress类
 * @Author 2214361854
 * @Date 2022/3/3 15:04
 * @Version 1.0
 */
public class IPDemo {
//    public static void main(String[] args) throws Exception {
//        InetAddress ip1 = InetAddress.getLocalHost();
//        System.out.println(ip1.getHostName());
//        System.out.println(ip1.getHostAddress());
//
//        //公网IP，域名
//        InetAddress ip2 = InetAddress.getByName("www.baidu.com");
//        System.out.println(ip2.getHostName());
//        System.out.println(ip2.getHostAddress());
//
//        System.out.println(ip1.isReachable(1000));
//        System.out.println(ip2.isReachable(1000));
//    }
}
